<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改用户</title>
    <link href="{{ url_for('static', filename = 'css/bootstrap.min.css') }}"
      rel="stylesheet">
  </head>
  <body>
    <div class="container">
      <div class="row justify-content-center align-items-center g-1">
        <div class="col-6 pt-5">
          <div class="card">
            <div class="card-header">
              新增用户
            </div>
            <div class="card-body">
              <form action="/edit" method="post">
                {% if item %}
                <input type="hidden" name="id" value="{{item.id}}">
                <div class="row mb-3">
                  <!-- {{item}} -->
                  <label for="colFormLabelSm"
                    class="col-sm-2 col-form-label col-form-label">姓名</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control form-control-sm"
                      id="colFormLabelSm" name="name" value="{{item.name}}"
                      required>
                  </div>
                </div>
                <div class="row mb-3">
                  <label for="age" class="col-sm-2 col-form-label">年龄</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="age" name="age"
                      value="{{item.age}}" required>
                  </div>
                </div>
                <div class="row mb-3">
                  <label for="gender" class="col-sm-2 col-form-label">性别</label>
                  <div class="col-3">
                    <input class="form-check-input" type="radio" name="gender"
                      id="gender01" value="男" {% if item.gender=="男" %} checked
                      {% endif %}>
                    <label class="form-check-label" for="gender01">男</label>
                  </div>
                  <div class="col-2">
                    <input class="form-check-input" type="radio" name="gender"
                      id="gender02" value="女" {% if item.gender=="女" %} checked
                      {% endif %}>
                    <label class="form-check-label" for="gender02">女</label>
                  </div>
                </div>
                <div class="row mb-3">
                  <label for="phone"
                    class="col-sm-2 col-form-label">联系电话</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" id="phone"
                      name="phone" value="{{item.phone}}" required>
                  </div>
                </div>
                <div
                  class="row mb-3 justify-content-center align-items-center ">
                  <div class="col-6">
                    <a type="button" class="btn btn-secondary  " href="/">
                      取消
                    </a>
                    <button type="submit" class="btn btn-primary ">
                      保存
                    </button>
                  </div>
                </div>
                {% endif %}
              </form>
            </div>
          </div>
          <div class="bg-warning  ">{{success}}</div>
        </div>
      </div>
    </div>
  </body>
</html>